package com.tutu.rabbitmq.custome;

import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * @Program: SpringBoot
 * @Description: 消费者
 * @Author: JK.TuTu
 * @Create: 2022-11-09 10:42
 **/
@Component

public class Customer {
    /**
     * helloworld模型 消费者
     * @param message
     */
    @RabbitListener(queuesToDeclare = @Queue(value = "helloworld"))  //绑定的消息队列为helloworld
    public void receive1(String message) {
        System.out.println("接受到的消息是:" + message);
    }

    /**
     * WorkQueue模型 消费者1
     * @param message
     */
    @RabbitListener(queuesToDeclare = @Queue("WorkQueue"))
    public void receive2(String message){
        System.out.println("消费者1接收到的消息是:"+message);
    }

    /**
     * WorkQueue模型 消费者2
     * @param message
     */
    @RabbitListener(queuesToDeclare = @Queue("WorkQueue"))
    public void receive3(String message){
        System.out.println("消费者2接收到的消息是:"+message);
    }

}
